home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / ubiquity / base-installer / kernel.sh
Encoding:
Text File  |  2009-04-19  |  2.7 KB  |  113 lines

  1. arch_get_kernel_flavour () {
  2.     VENDOR=`grep '^vendor_id' "$CPUINFO" | head -n1 | cut -d: -f2`
  3.     FAMILY=`grep '^cpu family' "$CPUINFO" | head -n1 | cut -d: -f2`
  4.     MODEL=`grep '^model[[:space:]]*:' "$CPUINFO" | head -n1 | cut -d: -f2`
  5.  
  6.     # Only offer bigmem is the system supports pae and the
  7.     # installer itself is already using a bigmem kernel.
  8.     if grep '^flags' "$CPUINFO" | grep -q pae ; then
  9.         case "$KERNEL_FLAVOUR" in
  10.         686-bigmem*|server|xen) BIGMEM="-bigmem" ;;
  11.         *) BIGMEM="-may-bigmem" ;;
  12.         esac
  13.     fi
  14.  
  15.     case "$VENDOR" in
  16.         " AuthenticAMD"*)
  17.         case "$FAMILY" in
  18.             " 15"|" 16"|" 17")            # k8
  19.             echo 686$BIGMEM
  20.             ;;
  21.             " 6")                # k7
  22.             case "$MODEL" in
  23.                 " 0"|" 1"|" 2"|" 3"|" 4"|" 5")
  24.                 # May not have SSE support
  25.                 echo 586 ;;
  26.                 *)    echo 686$BIGMEM ;;
  27.             esac
  28.             ;;
  29.             " 5")                # k6
  30.             echo 586
  31.             ;;
  32.             *)        echo 486 ;;
  33.         esac
  34.         ;;
  35.         " GenuineIntel")
  36.         case "$FAMILY" in
  37.             " 6"|" 15")    echo 686$BIGMEM ;;
  38.             " 5")    echo 586 ;;
  39.             *)        echo 486 ;;
  40.         esac
  41.         ;;
  42.         " GenuineTMx86"*)
  43.         case "$FAMILY" in
  44.             " 5"|" 6"|" 15")    echo 586 ;;
  45.             *)            echo 486 ;;
  46.         esac
  47.         ;;
  48.         " CentaurHauls")
  49.         case "$FAMILY" in
  50.             " 6")
  51.             case "$MODEL" in
  52.                 " 9"|" 10")    echo 686$BIGMEM ;;
  53.                 *)        echo 586 ;;
  54.             esac
  55.             ;;
  56.             *)
  57.             echo 486 ;;
  58.         esac
  59.         ;;
  60.         *)
  61.         echo 486 ;;
  62.     esac
  63.     return 0
  64. }
  65.  
  66. # Note: the -k7 flavor has been dropped with linux-2.6 (2.6.23-1)
  67.  
  68. arch_check_usable_kernel () {
  69.     if echo "$1" | grep -Eq -- "-386(-.*)?$"; then return 0; fi
  70.     if [ "$2" = 486 ]; then return 1; fi
  71.     if echo "$1" | grep -Eq -- "-(generic|virtual|rt)(-.*)?$"; then return 0; fi
  72.     if [ "$2" = 586 ] || [ "$2" = 686 ]; then return 1; fi
  73.     if echo "$1" | grep -Eq -- "-(server|xen)(-.*)?$"; then return 0; fi
  74.     if [ "$2" = 686-may-bigmem ] || [ "$2" = 686-bigmem ]; then return 1; fi
  75.  
  76.     # default to usable in case of strangeness
  77.     warning "Unknown kernel usability: $1 / $2"
  78.     return 0
  79. }
  80.  
  81. arch_get_kernel () {
  82.     imgbase=linux-image
  83.  
  84.     # See older versions of script for more flexible code structure
  85.     # that allows multiple levels of fallbacks
  86.     if [ "$1" = 686-bigmem ]; then
  87.         echo "linux-server"
  88.         echo "linux-image-server"
  89.         echo "linux-server-bigiron"
  90.         echo "linux-image-server-bigiron"
  91.         echo "linux-xen"
  92.         echo "linux-image-xen"
  93.     fi
  94.     if [ "$1" = 686-bigmem ] || [ "$1" = 686-may-bigmem ] || [ "$1" = 686 ] || [ "$1" = 586 ]; then
  95.         echo "linux-generic"
  96.         echo "linux-image-generic"
  97.         echo "linux-virtual"
  98.         echo "linux-image-virtual"
  99.         echo "linux-rt"
  100.         echo "linux-image-rt"
  101.     fi
  102.     if [ "$1" = 686-may-bigmem ]; then
  103.         echo "linux-server"
  104.         echo "linux-image-server"
  105.         echo "linux-server-bigiron"
  106.         echo "linux-image-server-bigiron"
  107.         echo "linux-xen"
  108.         echo "linux-image-xen"
  109.     fi
  110.     echo "linux-386"
  111.     echo "linux-image-386"
  112. }
  113.